package com.csk.zsk.compents.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.csk.zsk.compents.dao.PlaylistDao;
import com.csk.zsk.compents.entity.Playlist;
import com.csk.zsk.compents.service.PlaylistService;

@Service
@Transactional
public class PlaylistServiceImpl implements PlaylistService {

	@Autowired
	private PlaylistDao playlistDao;

	@Override
	public void savePlaylist(Playlist playlist) {
		playlistDao.save(playlist);

	}

	@Override
	public void deletePlaylist(String id) {
		playlistDao.delete(id);

	}

	@Override
	@Transactional(readOnly = true)
	public List<Playlist> getAll() {
		return playlistDao.getAll();
	}

	@Override
	@Transactional(readOnly = true)
	public Playlist getLovePlaylistByUserId(String userId) {
		return playlistDao.getLovePlaylistByUserId(userId);
	}

	@Override
	@Transactional(readOnly = true)
	public List<Playlist> getPlaylistByUserId(String userId) {
		return playlistDao.getPlaylistByUserId(userId);
	}

	@Override
	@Transactional(readOnly = true)
	public Playlist getPlaylistById(String id) {
		return playlistDao.getIdByGetMethod(id);
	}
}
